package com.example.downlinetext;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.Paint;
import android.os.Bundle;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;

import com.google.android.material.textfield.TextInputEditText;

import org.w3c.dom.Text;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;

public class MainActivity extends AppCompatActivity  {

    UnderLineTextView tv,tv1;
    TextView answerBookQuestion;
    FruitSliceView viewById;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        moveSurfaceView m = new moveSurfaceView(this);

//        setContentView(m);
        setContentView(R.layout.activity_main);
        viewById = (FruitSliceView)findViewById(R.id.view);
        String AnswerString = "鸾衾凤褥夜,\n领航常孤宿凤褥夜,\n领航常孤宿褥夜,\n领航常孤衾凤褥夜,\n领航常孤宿";
        String AnswerString1 = "鸾衾凤褥夜,领航常孤宿鸾衾凤褥夜,领航常孤宿鸾衾凤褥夜,领航常孤宿鸾褥夜,领航常孤宿";
        StringBuilder sb = new StringBuilder();
        sb.append(AnswerString);
        tv1 = findViewById(R.id.tv1);
        answerBookQuestion = findViewById(R.id.answerBookQuestion);
        tv = findViewById(R.id.tv);
        tv.setText(sb.toString());
        tv1.setText(AnswerString1);
        tv.setUnderlineNumPosition(5);
        answerBookQuestion.setText(AnswerString1);
        answerBookQuestion.setSingleLine(true);
        answerBookQuestion.setEllipsize(TextUtils.TruncateAt.END);
//        Log.d("TAG","onCreate");
    }
//    @Override
//    public boolean dispatchTouchEvent(MotionEvent ev) {
//        viewById.onTouch(ev);
//        return super.dispatchTouchEvent(ev);
//    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        viewById.onTouch(ev);
        return super.dispatchTouchEvent(ev);
    }
    @Override
    protected void onResume() {
        super.onResume();
        Log.d("TAG","onResume");
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.d("TAG","onStart");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.d("TAG","onStop");
    }



}